﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace IFTRUE.EIMS.Web
{
    /// <summary>
    /// 作用：系统信息
    /// 作者：iftrue
    /// 日期：2013-08-22
    /// </summary>
    public class SysMsg
    {
        public static string Fail = "{\"statusCode\":\"300\", \"message\":\"操作失败，请稍后再试\"}";
        public static string Error = "{\"statusCode\":\"300\", \"message\":\"系统错误，请联系管理员\"}";
        public static string Exception = "{\"statusCode\":\"300\", \"message\":\"系统异常，请联系管理员\"}";
        private static string Success = "\"statusCode\":\"200\", \"message\":\"{0}\", \"navTabId\":\"{1}\",\"forwardUrl\":\"{2}\", \"callbackType\":\"{3}\"";
        private static string Common = "\"statusCode\":\"300\", \"message\":\"{0}\"";

        /// <summary>
        /// 获取操作成功信息
        /// </summary>
        /// <param name="navTabId">要重载的标签</param>
        /// <param name="callbackType">回调类型</param>
        /// <returns></returns>
        public static string GetSuccessMsg(string navTabId,string callbackType)
        {
            return SysMsg.GetSuccessMsg("操作成功", navTabId, callbackType);
        }

        /// <summary>
        /// 获取操作成功信息
        /// </summary>
        /// <param name="msg">提示信息</param>
        /// <param name="navTabId">要重载的标签</param>
        /// <param name="callbackType">回调类型</param>
        /// <returns></returns>
        public static string GetSuccessMsg(string msg,string navTabId, string callbackType)
        {
            return "{" + string.Format(Success,msg, navTabId,"", callbackType) + "}";
        }

        /// <summary>
        /// 获取操作成功信息
        /// </summary>
        /// <param name="msg">提示信息</param>
        /// <param name="navTabId">要重载的标签</param>
        /// <param name="forwardUrl">跳转路径</param>
        /// <param name="callbackType">回调类型</param>
        /// <returns></returns>
        public static string GetSuccessMsg(string msg, string navTabId,string forwardUrl, string callbackType)
        {
            return "{" + string.Format(Success, msg, navTabId,forwardUrl, callbackType) + "}";
        }

        /// <summary>
        /// 获取通用提示信息
        /// </summary>
        /// <param name="strMsg">提示信息</param>
        /// <returns></returns>
        public static string GetCommonMsg(string strMsg)
        {
            return "{" + string.Format(Common, strMsg) + "}";
        }
    }
}